package com.unience.ec2.eclipse.config;

import org.eclipse.swt.widgets.Display;

import com.unience.aws.monitor.AwsMonitorThread;
import com.unience.ec2.test.LaunchEc2InstanceTest;

public class Config {
	
	private static Config instance = null;
	private LaunchEc2InstanceTest ec2Instance ;
	private Display display;
	
	private Object lastSelection;
	
	private Object treeModel;
	
	protected AwsMonitorThread updater;
	
	private String keyId;
	private String secretId;
	
	
	public AwsMonitorThread getUpdater() {
		return updater;
	}


	public void setUpdater(AwsMonitorThread updater) {
		this.updater = updater;
	}


	private Config(String keyId, String secret, String userId,String keyDir){
		this.keyId = keyId;
		this.secretId = secret;
		
		ec2Instance = new LaunchEc2InstanceTest(keyId, secret, userId );
		
		updater = new AwsMonitorThread(keyId,secret, userId, keyDir);
	}
	
	
	public static Config getInstance(String keyId, String secret, String userId,String keyDir){
		
		if (instance == null){
			instance = new Config(keyId, secret, userId, keyDir );
		}
		return instance;
	}
	
	public static Config getInstance(){
			
		return instance;
	}
	
	


	public LaunchEc2InstanceTest getEc2Instance() {
		return ec2Instance;
	}



	public Object getLastSelection() {
		return lastSelection;
	}


	public void setLastSelection(Object lastSelection) {
		this.lastSelection = lastSelection;
	}


	public Display getDisplay() {
		return display;
	}


	public void setDisplay(Display display) {
		this.display = display;
	}


	public Object getTreeModel() {
		return treeModel;
	}


	public void setTreeModel(Object treeModel) {
		this.treeModel = treeModel;
	}


	public String getKeyId() {
		return keyId;
	}


	public String getSecretId() {
		return secretId;
	}

}
